<%@page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String ctx = request.getContextPath();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content ="IE=edge,chrome=1" />
<title>附件查看</title>
	<script type="text/javascript" src="<%=ctx%>/websocket/jquery-1.12.3.min.js" ></script>
	<script type="text/javascript" src="<%=ctx%>/websocket/pdfobject.min.js"></script>
	<style type="text/css">
		html,body{
			height: 100%;margin: 0;background-color: #000000;color: #FFFFFF;
		}
	</style>
</head>
<body>
	<div style="width:100%; height:100%;" align="center" id="pdfv">
		<c:choose>
			<c:when test="${filetype!=null && filetype!='' && filetype=='image'}">
				<img src="<%=ctx%>/file/download?fileName=${fileurl}" style="width: 100%;" />
			</c:when>
			<c:when test="${filetype!=null && filetype!='' && filetype=='video'}">
				<video src="<%=ctx%>/file/download?fileName=${fileurl}" controls="controls" style="width: auto;max-height: 500px" >您的浏览器不支持 video 标签。</video>
			</c:when>
			<c:when test="${filetype!=null && filetype!='' && filetype=='error'}">
				<h5 align="center">不支持该文件类型的预览！</h5>
			</c:when>
			<c:otherwise>
				<h5 align="center"></h5>
			</c:otherwise>
		</c:choose>
	</div>
	<script type="text/javascript">
	<c:if test="${filetype!=null && filetype!='' && filetype=='office'}">
	$(function(){
		var options = {
			pdfOpenParams: {
				navpanes: 1,
				toolbar: 1,
				statusbar: 1,
				view:'FitV',
				pagemode: "thumbs"
			},
			height:"100%",
			width:"100%",
			forcePDFJS:true,
			PDFJS_URL:"<%=ctx%>/file/viewforce"
            //PDFJS_URL:"http://192.168.1.45:8080/websocket/file/viewforce"
		};
		
		PDFObject.embed("<%=ctx%>/file/downLoadio?filename=${fileurl}","#pdfv", options);
        //PDFObject.embed("http://192.168.1.45:8080/websocket/websocket/aa.pdf","#pdfv", options);
		//http://192.168.1.45:8080/websocket/websocket/pdf/pdf_viewforce.jsp
	});
	</c:if>
	function customHeightSet(contentHeight){
		$("#pdfv").height(contentHeight-2);
	}
	</script>
</body>
</html>